import { View, Image, Text } from "@tarojs/components";
import manageOne from "@/assets/image/ico_grzx_list_sjgl.svg";
import manageTwo from "@/assets/image/ico_grzx_list_dtgl.svg";
import manageThree from "@/assets/image/ico_grzx_list_flgl.svg";
import manageFour from "@/assets/image/ico_grzx_list_sjrz.svg";
import manageFive from "@/assets/image/ico_grzx_list_ptgl.svg";
import arrayIcon from "@/assets/image/ico_jiantou_one.svg";
import "./index.scss";
import { link } from "@/helper/utils";
import { routes } from "@/constants/routes";
import { useEffect, useState } from "react";
import { getPlatformCount } from "@/services/entities/all";
const MyPage = () => {
  const clickMenu = (url: string) => [link(url)];
  const [count, setCount] = useState<any>({});
  useEffect(() => {
    getPlatformCount().then((res) => {
      setCount(res);
    });
  }, []);
  return (
    <View className="my-container bg-page">
      <View className="header pl-48 pt-44 border-box">
        <Text className="fs-38 lh-54 cl-white">平台管理</Text>
      </View>
      <View className="main">
        <View className="content dis-flex justify-center">
          <View className="menu-container flex-column">
            <View className="menu pd-lr-24 border-box dis-flex pd-tb-40">
              <View className="flex-column flex-1 align-center justify-center">
                <Text className="fs-28 lh-38">平台商家总数</Text>
                <Text className="fs-54 lh-78 mt-10">
                  {count.allStoreCount ?? 0}
                </Text>
              </View>
              <View className="flex-column flex-1 align-center justify-center">
                <Text className="fs-28 lh-38">今日平台访问数</Text>
                <Text className="fs-54 lh-78 mt-10">
                  {count.visitCount ?? 0}
                </Text>
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                clickMenu(routes.ROUTES_SHOP_LOG);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageOne} />
                <Text className="ml-16 fs-30 lh-40 color-black">
                  商家访问记录
                </Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                link(routes.ROUTES_SHOP_MANAGE);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageOne} />
                <Text className="ml-16 fs-30 lh-40 color-black">商家管理</Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                link(routes.ROUTES_DYNAMIC_MANAGE);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageTwo} />
                <Text className="ml-16 fs-30 lh-40 color-black">动态管理</Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                link(routes.ROUTES_TYPE_MANAGE);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageThree} />
                <Text className="ml-16 fs-30 lh-40 color-black">分类管理</Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                link(routes.ROUTES_AD_MANAGE);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageFour} />
                <Text className="ml-16 fs-30 lh-40 color-black">广告管理</Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                link(routes.ROUTES_INIT_BANNER);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageFour} />
                <Text className="ml-16 fs-30 lh-40 color-black">首屏广告</Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
            <View
              className="menu mt-16 pd-lr-24 pd-tb-38 border-box dis-flex align-center justify-between"
              onClick={() => {
                link(routes.ROUTES_COOPERATION_MANAGE);
              }}
            >
              <View className="dis-flex align-center">
                <Image className="menu-icon" src={manageFive} />
                <Text className="ml-16 fs-30 lh-40 color-black">
                  合作平台管理
                </Text>
              </View>
              <View className="dis-flex align-center">
                <Image className="array-icon ml-12" src={arrayIcon} />
              </View>
            </View>
          </View>
        </View>
      </View>
    </View>
  );
};

export default MyPage;
